package com.music.service.folders.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Required;

import com.music.service.folders.beans.Folder;
import com.music.service.folders.dao.FolderDAO;
import com.music.service.folders.exceptions.PermissionDeniedException;

public class FolderServiceImpl implements FolderService {

	private FolderDAO mFolderDAO;
	
	
	/**
	 * @return the folderDAO
	 */
	public FolderDAO getFolderDAO() {
		return mFolderDAO;
	}

	/**
	 * @param pFolderDAO the folderDAO to set
	 */
	@Required
	public void setFolderDAO(FolderDAO pFolderDAO) {
		mFolderDAO = pFolderDAO;
	}

	public boolean addAlbumToFolder(Long pMemberId, Long pFolderId,
			Long pAlbumId) throws PermissionDeniedException {
		return getFolderDAO().addAlbumToFolder(pMemberId, pFolderId, pAlbumId) ;
	}

	public boolean addFolder(Long pMemberId, String pFolderName) {
		return getFolderDAO().addFolder(pMemberId, pFolderName) ;
	}

	public boolean checkMemberPermissionForFolder(Long pMemberId, Long pFolderId) {
		return getFolderDAO().checkMemberPermissionForFolder(pMemberId, pFolderId);
	}

	public boolean deleteAlbumFromFolder(Long pMemberId, Long pFolderId,Long pAlbumId)
				throws PermissionDeniedException {
		return getFolderDAO().deleteAlbumFromFolder(pMemberId, pFolderId, pAlbumId);
	}

	public boolean deleteFolder(Long pMemberId, Long pFolderId) {
		return getFolderDAO().deleteFolder(pMemberId, pFolderId);
	}

	public boolean editFolderName(Long pMemberId, Long pFolderId,String pFolderName) {
		return getFolderDAO().editFolderName(pMemberId, pFolderId, pFolderName);
	}

	public List<Folder> viewActiveFolders(Long pMemberId) {
		return getFolderDAO().viewActiveFolders(pMemberId);
	}

}
